public class UserUtil {
    // 修改自身密码
    public static void changePassword(User user) {
        System.out.print("请输入原密码：");
        String oldPwd = Main.sc.nextLine();
        if (!oldPwd.equals(user.getPassword())) {
            System.out.println("原密码错误，修改失败！");
            return;
        }

        System.out.print("请输入新密码：");
        String newPwd = Main.sc.nextLine();
        user.setPassword(newPwd);
        System.out.println("密码修改成功！");
        Main.sc.close();
    }
}
